package bento.views.pnls;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextPane;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

import bento.IHasWrapper;
import bento.IWrapper;
import bento.views.pnls.PnlOrders.Wrapper;

import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;

public class PnlOrders extends JPanel implements IHasWrapper<PnlOrders.Wrapper> {
    private Wrapper wrapper;
    
    @Override
    public Wrapper getWrapper() {
        return wrapper;
    }

    /**
     * Create the panel.
     */
    public PnlOrders() {
        setLayout(new BorderLayout(0, 0));
        
        JSplitPane splitPane = new JSplitPane();
        splitPane.setResizeWeight(0.2);
        splitPane.setOneTouchExpandable(true);
        add(splitPane);
        
        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setViewportBorder(new EmptyBorder(0, 5, 0, 5));
        splitPane.setLeftComponent(scrollPane);
        
        JPanel panel = new JPanel();
        scrollPane.setViewportView(panel);
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        
        JPanel panel_6 = new JPanel();
        panel_6.setBorder(new TitledBorder(null, "filter", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel.add(panel_6);
        panel_6.setLayout(new GridLayout(0, 1, 0, 0));
        
        JPanel panel_7 = new JPanel();
        panel_6.add(panel_7);
        
        JCheckBox checkBox = new JCheckBox("");
        panel_7.add(checkBox);
        
        JPanel panel_8 = new JPanel();
        panel_8.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
        panel_7.add(panel_8);
        
        JRadioButton rdbtnConfirm = new JRadioButton("confirm");
        panel_8.add(rdbtnConfirm);
        
        JRadioButton rdbtnUnconfirm = new JRadioButton("unconfirm");
        rdbtnUnconfirm.setSelected(true);
        panel_8.add(rdbtnUnconfirm);
        
        JPanel panel_5 = new JPanel();
        panel_5.setBorder(new TitledBorder(null, "orders", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel.add(panel_5);
        panel_5.setLayout(new BorderLayout(0, 0));
        
        JPanel panel_2 = new JPanel();
        panel_5.add(panel_2, BorderLayout.NORTH);
        panel_2.setLayout(new GridLayout(0, 1, 0, 0));
        
        JPanel panel_9 = new JPanel();
        panel_9.setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
        panel_2.add(panel_9);
        
        JButton button_2 = new JButton("New button");
        panel_9.add(button_2);
        
        JPanel panel_3 = new JPanel();
        panel_2.add(panel_3);
        panel_3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        
        JPanel panel_4 = new JPanel();
        panel_3.add(panel_4);
        panel_4.setLayout(new FormLayout(new ColumnSpec[] {
                ColumnSpec.decode("right:min"),
                ColumnSpec.decode("left:max(125px;default):grow"),},
            new RowSpec[] {
                FormFactory.DEFAULT_ROWSPEC,
                RowSpec.decode("default:grow"),}));
        
        JLabel lblId = new JLabel("id: ");
        panel_4.add(lblId, "1, 1");
        
        JTextPane textPane = new JTextPane();
        textPane.setBackground(UIManager.getColor("Button.background"));
        textPane.setText("123");
        panel_4.add(textPane, "2, 1, left, fill");
        
        JLabel lblXxxxxx = new JLabel("xxxxxx: ");
        panel_4.add(lblXxxxxx, "1, 2");
        
        JTextPane textPane_1 = new JTextPane();
        textPane_1.setEditable(false);
        textPane_1.setBackground(UIManager.getColor("Button.background"));
        textPane_1.setText("123");
        panel_4.add(textPane_1, "2, 2, left, fill");
        
        JScrollPane scrollPane_1 = new JScrollPane();
        splitPane.setRightComponent(scrollPane_1);
        
        JPanel panel_1 = new JPanel();
        scrollPane_1.setViewportView(panel_1);
        panel_1.setLayout(new BorderLayout(0, 0));
        
        JPanel panel_10 = new JPanel();
        panel_1.add(panel_10, BorderLayout.NORTH);
        
        JRadioButton rdbtnNewRadioButton = new JRadioButton("View");
        rdbtnNewRadioButton.setSelected(true);
        panel_10.add(rdbtnNewRadioButton);
        
        JRadioButton rdbtnNewRadioButton_1 = new JRadioButton("Edit");
        panel_10.add(rdbtnNewRadioButton_1);
        
        JPanel panel_11 = new JPanel();
        panel_1.add(panel_11, BorderLayout.CENTER);

    }
    
    public class Wrapper implements IWrapper<Component> {

        @Override
        public Component get() {
            return PnlOrders.this;
        }
        
        public Wrapper(bento.api.IBentoClient bentoClient) {
            PnlOrders.this.wrapper= this;
        }
    }
}
